package cn.com.bluemoon.daps.api.sys;

import cn.com.bluemoon.daps.api.sys.factory.RemoteSysDeptServiceFallbackFactory;
import cn.com.bluemoon.daps.common.constant.ServiceNameConstants.DapsApiSystem;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.system.entity.DapSystemDepartment;
import cn.com.bluemoon.daps.system.entity.DapSystemWechatDept;
import cn.com.bluemoon.daps.system.vo.DapSystemWechatDeptTreeVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

/**
 * 部门服务接口
 *
 * @author Jarod.Kong
 * @date 2020/12/21 14:09
 */
@FeignClient(value = DapsApiSystem.SERVICE, fallbackFactory = RemoteSysDeptServiceFallbackFactory.class)
@RequestMapping(DapsApiSystem.BASE_URI + DapsApiSystem.API_SYSDEPT)
@ApiIgnore
public interface RemoteSysDeptService {

    @GetMapping("/getById/{id}")
    @ApiOperation(value = "获取部门信息")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    public ResultBean<DapSystemDepartment> getById(@PathVariable(value = "id") String id);

    @GetMapping("/list")
    Map<String, String> dbDistinctDepartAndIdMap();

    @GetMapping("/listAll")
    @ApiOperation(value = "获取部门信息")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    public ResultBean<List<DapSystemDepartment>> listAll();

    @GetMapping("/getWechatDeptById")
    @ApiOperation(value = "部门id获取部门信息")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    public ResultBean<DapSystemWechatDept> getWechatDeptById(@RequestParam(value = "id") String id);

    @GetMapping("/getWechatDeptByName")
    @ApiOperation(value = "部门名称获取部门信息")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    public ResultBean<List<DapSystemWechatDept>> getWechatDeptByName(@RequestParam(value = "name") String name);


    @GetMapping("/getWechatDeptList")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    ResultBean<List<DapSystemWechatDeptTreeVo>> getWechatDeptList(@RequestParam(value = "level", required = false) Integer level);

}
